The present invention relates generally to transaction processing systems, and more particularly to techniques for preparing resource managers before phase one of the two-phase commitment (2PC) protocol commences.
A transaction most often is defined as an explicitly delimited operation, or set of related operations, that change or otherwise modify the content of an information collection (e.g., database or databases) from one consistent state to another. Changes are treated as a single unit in that all changes of a transaction are formed and made permanent (the transaction is xe2x80x9ccommittedxe2x80x9d) or none of the changes are made permanent (the transaction is xe2x80x9cabortedxe2x80x9d). If a failure occurs during the execution of a transaction, resulting in the transaction being aborted, whatever partial changes were made to the collection are undone to leave it in a consistent state.
A transaction processing system typically includes a transaction manager; a collection of subsystems, called resource managers (RMs), which are essentially abstractions of available services, such as database systems; programming languages; user interfaces; application interfaces; and the like. The transaction processing system provides a way to interconnect applications and resource managers while maintaining data integrity and transactional consistency. In this manner, any number of database systems (e.g., DB2, Oracle, Sybase, etc.), any number of programming languages (e.g., C++, Cobol, Fortran, etc.), any number of networks (e.g., OSI, TCP/IP, etc.), any number of presentation managers (e.g., Windows, DOS, etc.), and any number of application generators (e.g., CSP, Pathmaker, Cadre, etc.) are able to interoperate to complete a transaction.
The application process initiating a transaction invokes various services and/or resource managers to perform various operations and tasks necessary to complete the transaction. All services and resource managers invoked to perform operations for the transaction register with a transaction manager, stating that they are joining the transaction. A transaction manager typically provides transaction management functions, such as monitoring the progress of the transaction and coordinating the commit processing and rollback of the transaction, and protects the integrity of user data. When all operations, or work, have completed, the initiating application process notifies the transaction manager of this fact. The transaction manager then initiates an agreement protocol to coordinate commitment processing among all services and resource managers participating in the transaction. In transaction processing the standard agreement protocol is the two-phase commitment (2PC) protocol. A description of the 2PC protocol, as well as a detailed overview of transaction processing, is presented in J. Gray et al., Transaction Processing Concepts and Techniques, Morgan Kauffman, 1993, the contents of which are herein incorporated by reference.
Briefly, in phase one of the 2PC protocol, the transaction manager issues a request prepare signal to each participant (i.e., the transaction manager asks each participating service or resource manager if it believes the operations it performed to be a consistent and complete transformation). If any participant votes no, the commit fails and the transaction is aborted and rolled back; if all participating resource managers vote yes (ready to commit), the transaction is a correct transformation and phase two commences. In phase two of the 2PC protocol, the transaction manager issues a commit request signal informing each participant that the transaction is complete, and records this fact in the transaction""s log. After all participants acknowledge the commit request, the transaction manager records this fact and forgets about the transaction.
The present invention provides methods and systems for enhancing transaction processing systems having volatile resource managers that rely on other recoverable resource managers for their work.
In particular, the techniques of the present invention give a resource manager the ability to register with the transaction manager that it needs to be xe2x80x9cpre-preparedxe2x80x9d for a transaction. For example, a volatile resource manager may want to flush its cache to a recoverable resource manager. The transaction manager will issue a pre-prepare notification to any resource manager so registered, and will delay phase one of the commitment processing until all notified resource managers have responded that they are ready for commitment processing.
According to an aspect of the present invention, a transaction processing system is provided for processing a transaction initiated by an application process, wherein one or more resource managers participate in performing one or more operations for the transaction. The system typically comprises a transaction manager (TM) which coordinates a commitment processing protocol for all participating resource managers performing an operation for the transaction. All of the participating resource managers notify the TM that they are performing an operation for the transaction and that they wish to take part in the commitment processing protocol, which includes a prepare processing phase and a commit processing phase. The system also typically includes a volatile resource manager (VRM), communicably coupled to the TM, which notifies the TM that it is performing an operation for the transaction and that it desires to be notified in advance of said prepare processing phase. The TM issues a pre-prepare notification to the VRM and delays the prepare phase processing for all participating resource managers until the VRM issues a ready signal in response to the pre-prepare notification signal.
According to another aspect of the present invention, a method is provided for preparing for commitment processing of a transaction initiated by an application process in a transaction processing system having a transaction manager (TM) and one or more resource managers that participate in performing one or more operations for the transaction. The TM coordinates a commitment processing protocol for all participating resource managers performing an operation for the transaction. All of the participating resource managers notify the TM that they are performing an operation for the transaction and that they wish to take part in the commitment processing protocol, which includes a prepare processing phase and a commit processing phase. The method typically comprises the steps of: issuing a request from a volatile resource manager (VRM), which is communicably coupled to the TM, indicating that the VRM is performing an operation for the transaction and that the VRM desires notification before the prepare processing phase begins; issuing a pre-prepare notification signal from the TM to the VRM; and delaying the prepare processing phase for all participating resource managers, including the VRM, until the VRM issues a ready signal in response to the pre-prepare notification signal.
According to yet another aspect of the present invention, a method is provided for preparing for commitment processing of a transaction initiated by an application process in a transaction processing system having a transaction manager (TM) and one or more resource managers that participate in performing one or more operations for the transaction. The TM coordinates a commitment processing protocol for all participating resource managers performing an operation for the transaction. All of the participating resource managers notify the TM that they are performing an operation for the transaction and that they wish to take part in the commitment processing protocol, which includes a prepare processing phase and a commit processing phase. The method typically comprises the steps of: issuing a request from a volatile resource manager (VRM), communicably coupled to the TM, indicating that the VRM is performing an operation for the transaction and that the VRM desires notification before said prepare processing phase begins; issuing a pre-prepare notification signal from the TM to the VRM, wherein the VRM performs one or more pre-prepare operations after receiving the pre-prepare notification signal; issuing a ready signal from the VRM after the VRM has completed the one or more pre-prepare operations; and thereafter commencing the prepare processing phase of the commitment processing protocol for all participating resource managers, including the VRM.
According to a further aspect of the invention, a method is provided for preparing for commitment processing of a transaction initiated by an application process in a transaction processing system having a transaction manager (TM) and one or more resource managers that participate in performing one or more operations for the transaction. The TM coordinates a commitment processing protocol for all participating resource managers performing an operation for the transaction, wherein all of the participating resource managers notify the TM that they are performing an operation for the transaction and that they wish to take part in the commitment processing protocol, which includes a prepare processing phase and a commit processing phase. The method typically comprises the steps of: issuing a request from a volatile resource manager (VRM), communicably coupled to the TM, indicating that the VRM is performing an operation for the transaction and that the VRM desires notification before said prepare processing phase begins, wherein the VRM is located in a transaction management domain remote from the TM, the remote transaction management domain including a remote transaction manager (RTM) which coordinates the commitment processing protocol for the VRM, wherein a communication resource manager (CRM) communicably couples the TM with the remote transaction management domain; issuing a first prepare notification signal from the TM to the RTM; issuing a pre-prepare notification from the RTM to the VRM; and delaying the prepare processing phase for the VRM, until the VRM issues a ready signal in response to the pre-prepare notification signal.